package com.hzncc.scaffold.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.hzncc.scaffold.entity.Bo.CvListBo;
import com.hzncc.scaffold.entity.Other.Cvpost;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author DrunkBear
 * @since 2022-04-27
 */
public interface CvpostMapper extends BaseMapper<Cvpost> {

    @Select("SELECT\n" +
            "\t`cvpost`.`id`,\n" +
            "\t`cvpost`.`title`,\n" +
            "\t`cvpost`.`createTime`,\n" +
            "\t`cvpost`.`url`,\n" +
            "\t`user`.`id` AS `userId`,\n" +
            "\t`user`.`name` AS `userName`,\n" +
            "\t`user`.`realname` AS `userRealname`,\n" +
            "\t`user`.`gender` AS `userGender`,\n" +
            "\t`user`.`telephone` AS `userTelephone`,\n" +
            "\t`user`.`email` AS `userEmail`,\n" +
            "\t`user`.`idCardNum` AS `userIdCardNum`,\n" +
            "\t`Job`.`id` AS `jobId`,\n" +
            "\t`Job`.`title` AS `jobTitle` \n" +
            "FROM\n" +
            "\t`cvpost` AS `cvpost`\n" +
            "\tLEFT OUTER JOIN `user` AS `user` ON `cvpost`.`userId` = `user`.`id`\n" +
            "\tLEFT OUTER JOIN `job` AS `Job` ON `cvpost`.`jobId` = `Job`.`id` \n ${ew.customSqlSegment}" +
            "ORDER BY\n" +
            "\t`cvpost`.`id` DESC ")
    public List<CvListBo> cvList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

}
